<?php

/**
 * api actions.
 *
 * @package    orangehrm
 * @subpackage api
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class apiActions extends sfActions {
    /**
     * Executes index action
     *
     * @param sfRequest $request A request object
     */

    public function executeIndex(sfWebRequest $request) {

        // set response type to json

        $this -> getResponse() -> setContentType('application/json');
        $data_json = array('errors' => 0, 'message' => '', 'data_return' => null);

        $model = $request -> getParameter('model');
        $model = "API".ucfirst($model);
        if (!class_exists(ucfirst($model))) {
            header('HTTP/1.1 404 Not Found');
            return;
        }



        $instance = new $model;


        if (is_callable(array($instance , "execute"))) {
            call_user_func(array($instance , 'execute') ) ;
        }

        return sfView::NONE;

    }

}
